﻿<div ng-controller="DetailLockOrderC">
    <div class="bg-light lter b-b wrapper-md">
        <h1 class="m-n font-thin h3">锁价单详情</h1>
    </div>
    <div class="wrapper-md">
        <div class="panel panel-default">
            <div class="table-responsive">
                <form name="form" class="form-validation">
                    <div class="panel panel-default">
                        <div class="panel-body">
                            <div class="form-group">
                                <label>客户信息</label>
                                <input type="text" class="form-control" readonly="readonly" value="{{dataLockOrder.Customer.Name}}--{{dataLockOrder.Customer.ShortName}}">
                            </div>
                            <div class="form-group">
                                <label>客户户头</label>
                                <input type="text" class="form-control" readonly="readonly" value="{{dataLockOrder.Account.Name}}">
                            </div>
                            <div class="form-group">
                                <label>供应商</label>
                                <input type="text" class="form-control" readonly="readonly" value="{{dataLockOrder.Provider.Name}}">
                            </div>
                            <div class="form-group">
                                <label style="margin-right: 10px;">是否标件:</label>
                                <!--<label class="i-switch bg-info">-->
                                    <!--<input type="checkbox" disabled="disabled" ng-model="dataLockOrder.IsStandard">-->
                                    <!--<i></i>-->
                                <!--</label>-->
                                <span ng-if="dataLockOrder.IsStandard">标件</span>
                                <span ng-if="!dataLockOrder.IsStandard">非标件</span>
                            </div>
                            <!--<div class="form-group">-->
                                <!--<label style="margin-right: 10px;">审批中</label>-->
                                <!--<label class="i-switch bg-info">-->
                                    <!--<input type="checkbox" disabled="disabled" ng-model="dataLockOrder.IsApproval">-->
                                    <!--<i></i>-->
                                <!--</label>-->
                            <!--</div>-->
                            <!--<div class="form-group">-->
                                <!--<label style="margin-right: 10px;">是否暂停</label>-->
                                <!--<label class="i-switch bg-info">-->
                                    <!--<input type="checkbox" disabled="disabled" ng-model="dataLockOrder.IsPause">-->
                                    <!--<i></i>-->
                                <!--</label>-->
                            <!--</div>-->
                            <div class="form-group">
                                <label>订单类型:</label>
                                <label ng-if="dataLockOrder.OrderType == 0">普通订单</label>
                                <label ng-if="dataLockOrder.OrderType == 1">商品锁价</label>
                                <label ng-if="dataLockOrder.OrderType == 2">基价锁价</label>
                                <label ng-if="dataLockOrder.OrderType == 3">自采订单</label>
                            </div>
                            <div class="form-group">
                                <label>锁价单总额:</label>
                                <label>{{dataLockOrder.Total | number:2}}</label>
                            </div>
                            <div class="form-group">
                                <label>每吨优惠合计:</label>
                                <label>{{dataLockOrder.UnitDiscount | number:2}}</label>
                            </div>
                            <div class="form-group">
                                <label>商品列表</label>
                                <ul>
                                    <li>
                                        <label>名称</label>
                                        <label>材质</label>
                                        <label>规格</label>
                                        <label>/件重/</label>
                                        <label>[价格]</label><br>
                                    </li>
                                    <li ng-repeat="item in dataLockOrder.DepotCommodityRecords">
                                        <label>{{item.Commodity.Name}}</label>
                                        <label>{{item.Commodity.Standard}}</label>
                                        <label>{{item.Commodity.Format}}</label>
                                        <label>/{{item.Commodity.Weight}}/</label>
                                        <label>[{{item.Price | number:2}}]</label><br>
                                    </li>
                                </ul>
                            </div>
                            <div class="form-group">
                                <label>相关订单（创建时间/编号/总金额/状态）</label>
                                <ul>
                                    <li ng-repeat="item in dataLockOrder.Orders | orderBy:['CreateTime']">
                                        {{item.CreateTime}}/{{item.CodeNum}}/{{item.Total | number:2}}/
                                        <label ng-if="item.State == 0">待确认</label>
                                        <label ng-if="item.State == 1">驻厂确认</label>
                                        <label ng-if="item.State == 2">已发货</label>
                                        <label ng-if="item.State == 3">已收货</label>
                                        <label ng-if="item.State == 4">已结算</label>
                                        <label ng-if="item.State == 5">完结</label>
                                        <label ng-if="item.State == 6">取消</label>
                                        <label ng-if="item.State == 7">审核通过</label>
                                        <label ng-if="item.State == 8">已退货</label>
                                        <label ng-if="item.State == 9">已退款</label>
                                    </li>
                                </ul>
                            </div>
                            <!--<div class="form-group">-->
                                <!--<label>变更记录</label>-->
                                <!--<ul>-->
                                    <!--<li ng-repeat="item in dataLockOrder.Records | orderBy:['CreateTime']">-->
                                        <!--{{item.CreateTime}}/<label ng-if="item.Price != 0">{{item.Price | number:2}}/</label>{{item.Remarks}}-->
                                    <!--</li>-->
                                <!--</ul>-->
                            <!--</div>-->
                            <div class="form-group">
                                <accordion close-others="oneAtATime">
                                    <accordion-group heading="查看历史记录➤">
                                        <ul>
                                            <li ng-repeat="item in dataLockOrder.Records | orderBy:['CreateTime']">
                                                {{item.CreateTime}}/<label ng-if="item.Price != 0">{{item.Price | number:2}}/</label>{{item.Remarks}}
                                            </li>
                                        </ul>
                                    </accordion-group>
                                </accordion>
                            </div>
                            <!--<div class="form-group" ng-if="dataLockOrder.IsApproval">
                                <label style="margin-right: 10px;">审批中</label>
                            </div>
                            <div class="form-group" ng-if="dataLockOrder.IsPause">
                                <label style="margin-right: 10px;">已暂停</label>
                            </div>-->
                            <div class="form-group">
                                <label>状态:</label>
                                <label ng-if="dataLockOrder.IsPause">已暂停</label>
                                <label ng-if="dataLockOrder.IsApproval">审批中</label>
                                <span ng-if="!dataLockOrder.IsApproval&&!dataLockOrder.IsPause">
                                    <label ng-if="dataLockOrder.ProcessState == 0">正常</label>
                                    <label ng-if="dataLockOrder.ProcessState == 1">议价</label>
                                    <label ng-if="dataLockOrder.ProcessState == 2">锁价</label>
                                    <label ng-if="dataLockOrder.ProcessState == 3">款项确认</label>
                                    <label ng-if="dataLockOrder.ProcessState == 4">完结</label>/
                                    <label ng-if="dataLockOrder.State == 0">待确认</label>
                                    <label ng-if="dataLockOrder.State == 1">驻厂确认</label>
                                    <label ng-if="dataLockOrder.State == 2">已发货</label>
                                    <label ng-if="dataLockOrder.State == 3">已收货</label>
                                    <label ng-if="dataLockOrder.State == 4">已结算</label>
                                    <label ng-if="dataLockOrder.State == 5">完结</label>
                                    <label ng-if="dataLockOrder.State == 6">取消</label>
                                    <label ng-if="dataLockOrder.State == 7">审核通过</label>
                                    <label ng-if="dataLockOrder.State == 8">已退货</label>
                                    <label ng-if="dataLockOrder.State == 9">已退款</label>
                                </span>
                            </div>
                        </div>
                        <div class="container-fluid">
                            <div class="row" style="border-bottom: red solid 1px" ng-repeat="item in orderdetaildata.CommodityInfos">
                                <div class="col-xs-12 col-md-12">
                                    <div>钢厂：{{item.ProviderCommodity.Commodity.Brand}}</div>
                                    <div>名称/材质/规格：{{item.ProviderCommodity.Commodity.Name}}/{{item.ProviderCommodity.Commodity.Standard}}/{{item.ProviderCommodity.Commodity.Format}}</div>
                                    <div>单价：{{item.Price | number:2}}/t</div>
                                    <div>数量：{{item.Count}}</div>
                                    <div>总质量：{{item.ProviderCommodity.Commodity.Weight | number:3}}t</div>
                                    <div>总价：{{item.Price | number:2}}*{{item.ProviderCommodity.Commodity.Weight | number:3}}t={{item.Price*item.ProviderCommodity.Commodity.Weight | number:2}}</div>
                                </div>
                            </div>
                            <div class="row text-right">
                                <button type="button" class="btn btn-default" ng-click="abolish()">返回</button>
                            </div>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>

<script>
    angular.module('app')  //编辑员工控制器
    .controller("DetailLockOrderC", function ($scope, $state, $stateParams, $http) {
        $scope.orderiddetail = JSON.parse($stateParams.orderid);
        //获取员工数据方法
        $scope.refresh = function(){
            $http({
                url: "../api/LockOrder/Detail?id=" + $scope.orderiddetail,
                method:"GET"
            })
                    .then(function (res) {
                        $scope.dataLockOrder = res.data;
                        console.log($scope.dataLockOrder);
                    })
                    .then(function (error) {
                        if(error){
                            console.log("error");
                        }
                    });
        };
//        获取数据
        $scope.refresh();

        //返回上一页
        $scope.abolish = function(){
            $state.go('app.LockOrder_List');
        };
    })
</script>